<?php

$getPetInfo = fetch("SELECT * FROM user_pets2 WHERE owner = '$userid' AND id = '$use_on' AND game = '$game'");

if (!$getPetInfo[id])
{
		die("
		<br><center>
		<table width=380 cellspacing=0>
		<tr>
		<td bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Selected Item</font></b></center>
		</td>
		<td width=300 bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Item Details</font></b></center>
		</td>
		</tr>
		<tr height=100>
		<td valign=middle>
		<p align=center><img src=images/user_images/opg_$game/items/item_$find_item2[id].gif>
		<br>
		<b>$find_item2[item_name]</b>
		</td>
		<td width=300>
		<p 	align=center>That is not your pet.<br>($find_item[parts_left]/$find_item2[parts] Parts Left)<br><a href=myitems.php?game=$game>Back to Items</a></p>
		</td>
		</tr>
		</table>
		</center>
		");
}

$newAttitude = $getPetInfo[attitude] + $find_item2[magic_num];
if ($newAttitude > 100) { $newAttitude = 100; }
if ($newAttitude < 0) { $newAttitude = 0; }

mysql_query("UPDATE user_pets2 SET attitude = attitude + $find_item2[magic_num] WHERE id = '$use_on' AND game = '$game'");

if ($newAttitude <= 10)
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"These toys are getting really old!\"</p>";
}
if (($newAttitude <= 20) AND ($newAttitude > 10))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"That toy was pretty cool!\"</p>";
}
if (($newAttitude <= 30) AND ($newAttitude > 20))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"That toy was awesome, it was just what I needed!\"</p>";
}
if (($newAttitude <= 40) AND ($newAttitude > 30))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"I feel sooo much better now!!\"</p>";
}
if (($newAttitude <= 50) AND ($newAttitude > 40))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"Can't we do something else?\"</p>";
}
if (($newAttitude <= 60) AND ($newAttitude > 50))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"I'm getting pretty hungry, too bad I can't eat this toy!\"</p>";
}
if (($newAttitude <= 70) AND ($newAttitude > 60))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"This is lots of fun, let's play again!\"</p>";
}
if (($newAttitude <= 80) AND ($newAttitude > 70))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"$display_name, you're the best!\"</p>";
}
if (($newAttitude <= 90) AND ($newAttitude > 80))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"Thanks for the awesome toy!!!!\"</p>";
}
if (($newAttitude <= 100) AND ($newAttitude > 90))
{
	$effect = "<p><b>$getPetInfo[name]</b> says \"I'm soooo happy you got this toy for me, I've always wanted it!!!\"</p>";
}

print "
		<br><center>
		<table width=380 cellspacing=0>
		<tr>
		<td bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Selected Item</font></b></center>
		</td>
		<td width=300 bgcolor=$topAndBottomBG>
		<center><b><font color=$topAndBottomText>Item Details</font></b></center>
		</td>
		</tr>
		<tr height=100>
		<td valign=middle>
		<p align=center><img src=images/user_images/opg_$game/items/item_$find_item2[id].gif>
		<br>
		<b>$find_item2[item_name]</b>
		</td>
		<td width=300>
		<p 	align=center>$effect<br>($find_item[parts_left]/$find_item2[parts] Parts Left)<br><a href=myitems.php?game=$game>Back to Items</a></p>
		</td>
		</tr>
		</table>
		</center>
";
?>